<template>
	<scroll-view class="list" scroll-y>
		<view class="content content-task">
			<view class="uni-list-cell" hover-class="uni-list-cell-hover" v-for="(info,index) in infos" :key="index" @click="goMeasureMetarialList(info.line_ids,info.measurement_type)">
				<view class="uni-list-cell-navigate uni-navigate-right">
					{{ measureType[info.measurement_type]}}
				</view>
			</view>
		</view>
		<view v-if="noData" class="cus-no-data">
			<text class="def-icon">&#xe64b;</text>
			<text> 暂 无 数 据 . . . </text>
		</view>
	</scroll-view>
</template>

<script>
	import { measureType } from '@/common/stateData.js'
	export default {
		data() {
			return {
				infos: [], //材料列表数据
				noData: false, //材料列表数据是否为空
				measureType: measureType,
				project_id: null
			}
		},
		onLoad(param) {
			this.project_id = parseInt(param.id)
			this.getListInfo(param.id)
		},
		methods: {
			//获取复尺材料分类数据
			getListInfo(id) {
				uni.showLoading({
					title: '',
					mask: false
				});
				uni.request({
					url: this.$store.state.baseUrl + '/lwj/get_material_measurement_order',
					method: 'POST',
					header: {
						token: this.$store.state.token
					},
					data: {
						project_id: id
					},
					success: res => {
						if (res.data.code === 1) {
							this.infos = res.data.data
							uni.hideLoading()
							if (res.data.data.length === 0) {
								this.noData = true
							} else {
								this.noData = false
							}
						}
					},
					fail: () => {},
					complete: () => {}
				});
			},
			//跳转到复尺材料列表页面
			goMeasureMetarialList(line_ids,measurement_type) {
				uni.navigateTo({
					url: './measureMaterialList?line_ids=' + JSON.stringify(line_ids) + '&measurement_type=' + measurement_type + '&project_id=' + this.project_id,
					success: res => {},
					fail: () => {},
					complete: () => {}
				});
			}
		},
	}
</script>

<style scoped>
	.list {
		background-color: #FFFFFF;
	}

	.content {
		background-color: #FFFFFF;
	}

	.drawer-content {
		padding: 10upx;
		overflow-y: auto;
		height: 100%;
	}

	.form-button {
		display: flex;
		justify-content: space-around;
		padding: 40upx 40upx;
	}

	.search-button {
		margin-right: 10upx;
	}

	.uni-list-cell-navigate {
		padding: 30upx;
	}
</style>
